package com.yuan.farmerwork.ynblog.rest;

import com.yuan.farmerwork.ynblog.domain.YnMian;
import com.yuan.farmerwork.ynblog.service.YnMianService;
import com.yuan.farmerwork.ynblog.utils.constants.PageConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 * 关于我页面前端控制器.
 *
 * @author yjs
 * @date 2021/1/14 15:42
 */
@Controller
public class AboutController {

    @Autowired
    private YnMianService ynMianService;

    /**
     * 关于我页面.
     *
     * @param map 页面参数map
     * @return
     */
    @GetMapping("/about")
    public ModelAndView about(Map map) {

        //获取首页介绍
        List<YnMian> ynMians = ynMianService.list();
        map.put(PageConstants.PAGE_PARAM_OWN_INTRO, ynMians.get(1).getMainTitle());
        return new ModelAndView(PageConstants.PAGE_ABOUT, map);
    }
}
